/**
 * Created by Administrator on 2017/1/11.
 */
function DateUtil() {
    this.compareStr = function (dateStr,otherDateStr) {
        var date1 = null;
        var date2 = null;
        if(dateStr&&$.trim(dateStr).length>0){
            date1 = new Date(dateStr);
        }else{
            date1 = new Date();
        }
        if(otherDateStr&&$.trim(otherDateStr).length>0){
            date2 = new Date(otherDateStr);
        }else{
            date2 = new Date();
        }
        if(date1.getTime()<date2.getTime()){
            return true;
        }else{
            return false;
        }
    };
    this.compareDate = function (date,otherDate) {
        var date1 = null;
        var date2 = null;
        if(date&&date instanceof Date){
            date1 = date;
        }else{
            return false;
        }
        if(otherDate&&otherDate instanceof Date){
            date2 = otherDate;
        }else{
            date2 = new Date();
        }
        if(date1.getTime()<date2.getTime()){
            return true;
        }else{
            return false;
        }
    };
}

//价格金融相关方法
var  pricUtil={
		//获取毛利率
		getGrossMargin:function(quote,totalCost){
			
			 var quoteFormat = new Number(quote).toFixed(2);
				 quoteFormat =typeof(quoteFormat)=="NaN"?0.00:quoteFormat;
				 if(quoteFormat==0||quoteFormat==0.00){
					 return "0.00%";
				 }
			 var totalCostFormat=new Number(totalCost).toFixed(2);
			    totalCostFormat =typeof(totalCostFormat)=="NaN"?0.00:totalCostFormat;
			var grossMargin=new Number(parseFloat((quoteFormat-totalCostFormat)/quoteFormat)*100).toFixed(2);
			return grossMargin+"%";
		}
		
}